import {
	axios
} from "./axios.js";

// 获取轮播图和购物车商品数量
export const getGoodsIndexPageSwiperApi = () => {
	return axios({
		url: '/goods-index-swiper/getGoodsIndexPageSwiperApi',
		method: 'get',
		headers: {
			token: uni.getStorageSync("token")
		}
	})
}


// 获取商品首页其他所有商品展示的信息
export const getGoodsIndexRecommendInfo = (param) => {
	return axios({
		url: '/goods/getGoodsIndexRecommendInfo',
		method: 'get',
		params: param
	})
}

// 商品详情页面获取商品的全部信息
export const getGoodsDetailInfo = (param) => {
	return axios({
		url: '/goods/getGoodsDetailInfo',
		method: 'get',
		params: param,
		headers: {
			token: uni.getStorageSync("token")
		}
	})
}



// 选择完毕之后请求后端返回该样式的价格，积分，库存等
export const getThisStyleInfoApi = (param) => {
	return axios({
		url: '/goods/getThisStyleInfoApi',
		method: 'get',
		params: param,
		headers: {
			token: uni.getStorageSync("token")
		}
	})
}

// 用户取消收藏
export const cancelCollectGoods = (param) => {
	return axios({
		url: '/goods/cancelCollectGoods',
		method: 'get',
		params: param,
		headers: {
			token: uni.getStorageSync("token")
		}
	})
}

// 用户收藏
export const collectGoods = (param) => {
	return axios({
		url: '/goods/collectGoods',
		method: 'get',
		params: param,
		headers: {
			token: uni.getStorageSync("token")
		}
	})
}

// 加入购物车
export const addCartApi = (param) => {
	return axios({
		url: '/goods/add-cart',
		method: 'post',
		data: param,
		headers: {
			token: uni.getStorageSync("token")
		}
	})
}


// 获取当前样式aid
export const getCurrentStyleAid = (param) => {
	return axios({
		url: `/goods/getCurrentStyleAid`,
		method: 'get',
		params: param,
		headers: {
			token: uni.getStorageSync("token")
		}
	})
}

// 获取我的购物车信息
export const getMyCartInfo = () => {
	return axios({
		url: `/cart/getMyCartInfo`,
		method: 'get',
		headers: {
			token: uni.getStorageSync("token")
		}
	})
}



// 删除购物车商品
export const deleteCartGoods = (data) => {
	return axios({
		url: `/cart/deleteCartGoods`,
		method: 'post',
		data: data,
		headers: {
			token: uni.getStorageSync("token")
		}
	})
}



// 获取商品分类列表（列表里面包含所有商品）
export const getGoodsCategoryList = () => {
	return axios({
		url: `/good-category/getGoodsCategoryList`,
		method: 'get',
		
	})
}

// 根据分类aid获取商品
export const getGoodByCategoryAid = (param) => {
	return axios({
		url: `/good-category/getGoodByCategoryAid`,
		method: 'get',
		params: param
	})
}

// 根据搜索关键词搜索商品
export const getSearchResults = (param) => {
	return axios({
		url: `/goods/getSearchResults`,
		method: 'get',
		params: param,
		headers: {
			token: uni.getStorageSync("token")
		}
	})
}


// 获取搜索历史和猜你想搜
export const getsearchHistAndGuessSearchList = () => {
	return axios({
		url: `/goods/getsearchHistAndGuessSearchList`,
		method: 'get',
		headers: {
			token: uni.getStorageSync("token")
		}
	})
}


// 点击搜索历史其中一个的清除图标删除那一个搜索历史
export const deleteSearchByAid = (param) => {
	return axios({
		url: `/goods/deleteSearchByAid`,
		method: 'get',
		params: param,
		headers: {
			token: uni.getStorageSync("token")
		}
	})
}

// 添加搜索历史
export const addSearchHistory = (param) => {
	return axios({
		url: `/goods/addSearchHistory`,
		method: 'post',
		data: param,
		headers: {
			token: uni.getStorageSync("token")
		}
	})
}


// 删除所有商品搜索记录
export const deleteAllSearchHistory = () => {
	return axios({
		url: `/goods/deleteAllSearchHistory`,
		method: 'get',
		headers: {
			token: uni.getStorageSync("token")
		}
	})
}